package com.lucenly.card.view.dialog;

import android.app.Activity;
import android.app.Dialog;
import android.content.Context;
import android.support.annotation.NonNull;
import android.view.Display;
import android.view.View;
import android.view.WindowManager;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.lucenly.card.R;

public class UpDataDialog extends Dialog{
    public UpDataDialog(@NonNull final Activity context, final boolean isCancel) {
        super(context, R.style.alert_dialog);
        setContentView(R.layout.dialog_updata);
        initView(context,isCancel);
    }

    private void initView(Context context,boolean isCancel) {
        LinearLayout lLayout_bg = (LinearLayout) findViewById(R.id.lLayout_bg);
        WindowManager windowManager = (WindowManager) context
                .getSystemService(Context.WINDOW_SERVICE);
        Display display = windowManager.getDefaultDisplay();
        setCanceledOnTouchOutside(false);
        // 调整dialog背景大小
        lLayout_bg.setLayoutParams(new FrameLayout.LayoutParams((int) (display
                .getWidth() * 0.8), (int) (display.getHeight()*0.6)));
        setCanceledOnTouchOutside(isCancel);
    }
}
